package lgs.hm.homework.work4.birthday;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Calendar;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

@Configuration
@ImportResource(locations= {"birthday.cfg.xml"})
public class BirthdayXml {
	
	public static void main(String[] args) {
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(BirthdayXml.class);
		
		XiaoMing bean = context.getBean(XiaoMing.class);
		System.out.println(bean);
		XiaoFang bean3 = context.getBean(XiaoFang.class);
		System.out.println(bean3);
		
		
		OutputStream bean2 = context.getBean(OutputStream.class);
		String str="today is goodday\r\n" + 
				"the cloud is not found\r\n" + 
				"the air is soo cold\r\n" + 
				"my foot quik missing";
		try {
			bean2.write(str.getBytes());
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		
//		Calendar bean = (Calendar) context.getBean("aaa");
//		System.out.println(bean.getTime());
	}

}
